import Router from '@/router/index' 
const USER_KEY = 'userInfo';
//保存用户信息 路由在这里跳转  
export function setUser(user) {
    sessionStorage.setItem(USER_KEY, JSON.stringify(user));
      
}

//获取用户信息
export function getUser() {
    let user = sessionStorage.getItem(USER_KEY);
    if(!user){
        Router.push({
            path:'/login'  
        })
        return;
    }
    return JSON.parse(user);
}

//删除用户信息
export function removeUser() {
    sessionStorage.removeItem(USER_KEY);
}




//sessionStorage.clear();
